.section .init
.globl _start
_start:
#Load register r0 with the location of GPIO
ldr r0,=0x20200000
#Move the value 1 to r1, to enable the LED
mov r1,#1
#Left shift the value in r1 by 18, There are 54 GPIO pins, 6 setes of 4  bytes. In Each 4 byte section
# every 3 bits refers to a particular pin, here we want to enable the 16th pin, which is in the 2nd 4 byte
# section, and we need to set the 6th set of 3 bits as we are dealing with pins 10-19 in the 4 byte section
# Thus 6*3 =18
lsl r1,#18
# Store registier stores the value in the 1st argument into the address computed by the expression afterwards
# In this case r0 + 4 referring to the 2nd 4 byte section.
str r1,[r0,#4]
# Move 1 to r1 , this is to turn on the LED
mov r1,#1
# Shift by 16 to denote the 16th LED
lsl r1,#16
loop$: # loop infinitely to keep the switching between on and off
# Turn the LED on
str r1,[r0,#40]
#wait till the count in r2 becomes 0, the number 3F0000 is chosen based on the clock for the raspberry pi.
#The wait is for approximately 2 secs
mov r2,#0x3F0000
wait1$:
#Subtract one from the register
sub r2,#1
#Compare if the value in R2 is equal to 0
cmp r2,#0
#Branch if not equals flag is set
bne wait1$
#Turn the LED off
str r1,[r0,#28]
#Wait for LED to be off
mov r2,#0x3F0000
wait2$:
#Subract one from the register
sub r2,#1
#Compare if the value in R2 is equal to 0
cmp r2,#0
#branch if not equals flag is set
bne wait2$

b loop$
